Imports Microsoft.VisualBasic
Imports Cryptography
'newsDet :> jump to by pid/title

Public Class Globo
    Public dr As System.Data.OleDb.OleDbDataReader
    Public da As System.Data.OleDb.OleDbDataAdapter
    Public ds As New System.Data.DataSet
    Public oCrypto As New Cryptography.Cryptography
    Public Const sEncryptionKey As String = "BizNewz"

    Public Sub executesql(ByVal Str As String, ByVal bln As Boolean)
        'sql server 2005
        Dim con As New System.Data.OleDb.OleDbConnection("Provider=SQLOLEDB;Persist Security Info=False;Integrated Security=SSPI;database=biznewz;server=MUM-PC\BETA;")


        'sql server 2000
        'Dim con As New System.Data.OleDb.OleDbConnection("Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=BizNewz")


        Dim cmd As New System.Data.OleDb.OleDbCommand(Str, con)

        If con.State = Data.ConnectionState.Open Then con.Close()
        con.Open()


        If bln = True Then
            'data modification/ insertion/ deletion
            cmd.ExecuteNonQuery()
            con.Close()
        Else
            'bln = False: data retrieval
            cmd.ExecuteNonQuery()
            dr = cmd.ExecuteReader

        End If
    End Sub

    Public Sub Adapt(ByVal str1 As String)
        Dim con As New System.Data.OleDb.OleDbConnection("Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=BizNewz")
        da = New Data.OleDb.OleDbDataAdapter(str1, con)
        da.Fill(ds)

    End Sub
    '        Dim a As New Globo
    '        a.executesql("insert into Admin values('" & "a" & "', '" & "b" & "')")


    'Public Sub ResetFormControlValues(ByVal parent As Control)
    '    'Procedure for form reset
    '    For Each c As Control In parent.Controls
    '        If c.Controls.Count > 0 Then
    '            ResetFormControlValues(c)
    '        Else
    '            Select Case (c.GetType().ToString())
    '                Case "System.Web.UI.WebControls.TextBox"
    '                    CType(c, TextBox).Text = ""
    '                Case "System.Web.UI.WebControls.CheckBox"
    '                    CType(c, CheckBox).Checked = False
    '                Case "System.Web.UI.WebControls.RadioButton"
    '                    CType(c, RadioButton).Checked = False
    '                Case "System.Web.UI.WebControls.DropDownList"
    '                    CType(c, DropDownList).Text = ""

    '            End Select
    '        End If
    '    Next c
    'End Sub
End Class
